/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package meteocal.gui;

import javax.inject.Named;
import javax.enterprise.context.SessionScoped;
import java.io.Serializable;
import javax.ejb.EJB;
import meteocal.business.security.boundary.UserManager;
import meteocal.business.security.entity.User;

/**
 *
 * @author Francesca
 */
@Named(value = "searchUserBean")
@SessionScoped
public class SearchUserBean implements Serializable {

    private User user;
    private User selectedUser;
    private boolean canModify;

    public User getSelectedUser() {
        return selectedUser;
    }

    public void setSelectedUser(User selectedUser) {
        this.selectedUser = selectedUser;
    }
    
    @EJB
    UserManager um;
    /**
     * Creates a new instance of SearchUserBean
     */
    public SearchUserBean() {
        
    }
    
    public String uploadUserPersonalPage(){
       canModify = false;
       return "personal-page?faces-redirect=true";
    }
    
    public String uploadPersonalPage(){ 
       canModify = true; 
       selectedUser = um.getLoggedUser();
       return "personal-page?faces-redirect=true";
    }
    
    public String modifyPersonalInformation(){
        return "modify-page?faces-redirect=true";
    }

    public boolean isCanModify() {
        return canModify;
    }
    
    
}
